package com.jzo2o.customer.controller.worker;

import com.jzo2o.customer.model.domain.BankAccount;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController("workBankAccountController")
@RequestMapping("/worker/bank-account")
@Api("服务人员银行账户设置")
public class WorkerBankAccountController {
    @Resource
    private IBankAccountService bankAccountService;

    @PostMapping
    @ApiOperation("新增服务人员银行账户接口")
    public void addWorkBankAccount(@RequestBody @ApiParam(name = "dto", value = "银行账户信息")
                               BankAccountUpsertReqDTO dto,
                               HttpServletRequest request) {
        bankAccountService.addBankAccount(dto, request);
    }

    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前服务人员用户银行账户接口")
    public BankAccount getCurrentUserBankAccount(HttpServletRequest request) {
        return bankAccountService.getCurrentUserBankAccount(request);
    }
}
